{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import sys\n",
    "import warnings\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.model_selection import GridSearchCV\n",
    "\n",
    "warnings.filterwarnings(\"ignore\")\n",
    "plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签\n",
    "plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_325 = pd.read_excel(\"3-数据清洗后325样本数据.xlsx\", na_values=np.nan)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(325, 203)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_325.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['样本编号', '时间', 'RON损失', '原料性质：硫含量', '原料性质：辛烷值', '原料性质：饱和烃', '原料性质：烯烃',\n",
       "       '原料性质：芳烃', '原料性质：溴值', '原料性质：密度', '产品性质：硫含量', '产品性质：辛烷值', '待生吸附剂性质：焦炭',\n",
       "       '待生吸附剂性质：S', '再生吸附剂性质：焦炭', '再生吸附剂性质：S', 'S-ZORB.CAL_H2.PV',\n",
       "       'S-ZORB.PDI_2102.PV', 'S-ZORB.PT_2801.PV', 'S-ZORB.FC_2801.PV',\n",
       "       'S-ZORB.TE_2103.PV', 'S-ZORB.TE_2005.PV', 'S-ZORB.PT_2101.PV',\n",
       "       'S-ZORB.PDT_2104.PV', 'S-ZORB.TE_2301.PV', 'S-ZORB.PT_2301.PV',\n",
       "       'S-ZORB.PC_2105.PV', 'S-ZORB.PC_5101.PV', 'S-ZORB.TC_5005.PV',\n",
       "       'S-ZORB.LC_5001.PV'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_325.columns[:30]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_325.drop(['样本编号', '时间', '产品性质：硫含量', 'RON损失'], axis=1, inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>原料性质：硫含量</th>\n",
       "      <th>原料性质：辛烷值</th>\n",
       "      <th>原料性质：饱和烃</th>\n",
       "      <th>原料性质：烯烃</th>\n",
       "      <th>原料性质：芳烃</th>\n",
       "      <th>原料性质：溴值</th>\n",
       "      <th>原料性质：密度</th>\n",
       "      <th>产品性质：辛烷值</th>\n",
       "      <th>待生吸附剂性质：焦炭</th>\n",
       "      <th>待生吸附剂性质：S</th>\n",
       "      <th>...</th>\n",
       "      <th>S-ZORB.AT-0011.DACA.PV</th>\n",
       "      <th>S-ZORB.FT_1204.DACA.PV</th>\n",
       "      <th>S-ZORB.LC_5102.PIDA.PV</th>\n",
       "      <th>S-ZORB.TE_1102.DACA.PV</th>\n",
       "      <th>S-ZORB.CAL.LINE.PV</th>\n",
       "      <th>S-ZORB.CAL.CANGLIANG.PV</th>\n",
       "      <th>S-ZORB.CAL.SPEED.PV</th>\n",
       "      <th>S-ZORB.FT_1503.TOTALIZERA.PV</th>\n",
       "      <th>S-ZORB.FT_1504.TOTALIZERA.PV</th>\n",
       "      <th>S-ZORB.PC_1001A.PV</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>188.0</td>\n",
       "      <td>90.6</td>\n",
       "      <td>53.230000</td>\n",
       "      <td>24.400000</td>\n",
       "      <td>22.370000</td>\n",
       "      <td>61.487143</td>\n",
       "      <td>726.085714</td>\n",
       "      <td>89.22</td>\n",
       "      <td>2.32</td>\n",
       "      <td>7.30</td>\n",
       "      <td>...</td>\n",
       "      <td>0.496243</td>\n",
       "      <td>18.292067</td>\n",
       "      <td>42.015425</td>\n",
       "      <td>425.929515</td>\n",
       "      <td>0.282564</td>\n",
       "      <td>37.804650</td>\n",
       "      <td>3.324945</td>\n",
       "      <td>39063124.5</td>\n",
       "      <td>39608757.0</td>\n",
       "      <td>0.353271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>169.0</td>\n",
       "      <td>90.5</td>\n",
       "      <td>52.300000</td>\n",
       "      <td>26.400000</td>\n",
       "      <td>21.300000</td>\n",
       "      <td>61.880000</td>\n",
       "      <td>731.300000</td>\n",
       "      <td>89.32</td>\n",
       "      <td>2.37</td>\n",
       "      <td>7.34</td>\n",
       "      <td>...</td>\n",
       "      <td>0.491385</td>\n",
       "      <td>19.842605</td>\n",
       "      <td>40.903878</td>\n",
       "      <td>421.534365</td>\n",
       "      <td>0.281381</td>\n",
       "      <td>37.876006</td>\n",
       "      <td>3.321169</td>\n",
       "      <td>38810581.5</td>\n",
       "      <td>39389299.0</td>\n",
       "      <td>0.354504</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>177.0</td>\n",
       "      <td>90.7</td>\n",
       "      <td>52.300000</td>\n",
       "      <td>26.314286</td>\n",
       "      <td>21.385714</td>\n",
       "      <td>61.722857</td>\n",
       "      <td>729.614286</td>\n",
       "      <td>89.32</td>\n",
       "      <td>2.43</td>\n",
       "      <td>7.27</td>\n",
       "      <td>...</td>\n",
       "      <td>0.495483</td>\n",
       "      <td>26.994896</td>\n",
       "      <td>42.103142</td>\n",
       "      <td>425.258420</td>\n",
       "      <td>0.282277</td>\n",
       "      <td>37.907927</td>\n",
       "      <td>3.319569</td>\n",
       "      <td>38693812.0</td>\n",
       "      <td>39312616.5</td>\n",
       "      <td>0.350181</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>159.0</td>\n",
       "      <td>90.4</td>\n",
       "      <td>52.300000</td>\n",
       "      <td>26.100000</td>\n",
       "      <td>21.600000</td>\n",
       "      <td>61.330000</td>\n",
       "      <td>725.400000</td>\n",
       "      <td>89.02</td>\n",
       "      <td>3.08</td>\n",
       "      <td>7.35</td>\n",
       "      <td>...</td>\n",
       "      <td>0.490180</td>\n",
       "      <td>26.324458</td>\n",
       "      <td>41.970416</td>\n",
       "      <td>424.406195</td>\n",
       "      <td>0.282275</td>\n",
       "      <td>39.177396</td>\n",
       "      <td>3.210211</td>\n",
       "      <td>38410862.5</td>\n",
       "      <td>39120204.5</td>\n",
       "      <td>0.353930</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>173.0</td>\n",
       "      <td>89.6</td>\n",
       "      <td>52.242857</td>\n",
       "      <td>26.671429</td>\n",
       "      <td>21.085714</td>\n",
       "      <td>61.332857</td>\n",
       "      <td>725.428571</td>\n",
       "      <td>88.32</td>\n",
       "      <td>2.45</td>\n",
       "      <td>6.58</td>\n",
       "      <td>...</td>\n",
       "      <td>0.501194</td>\n",
       "      <td>30.224367</td>\n",
       "      <td>42.900094</td>\n",
       "      <td>428.514740</td>\n",
       "      <td>0.282963</td>\n",
       "      <td>39.508370</td>\n",
       "      <td>3.178832</td>\n",
       "      <td>38283000.0</td>\n",
       "      <td>39045953.5</td>\n",
       "      <td>0.358053</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 199 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   原料性质：硫含量  原料性质：辛烷值   原料性质：饱和烃    原料性质：烯烃    原料性质：芳烃    原料性质：溴值     原料性质：密度  \\\n",
       "0     188.0      90.6  53.230000  24.400000  22.370000  61.487143  726.085714   \n",
       "1     169.0      90.5  52.300000  26.400000  21.300000  61.880000  731.300000   \n",
       "2     177.0      90.7  52.300000  26.314286  21.385714  61.722857  729.614286   \n",
       "3     159.0      90.4  52.300000  26.100000  21.600000  61.330000  725.400000   \n",
       "4     173.0      89.6  52.242857  26.671429  21.085714  61.332857  725.428571   \n",
       "\n",
       "   产品性质：辛烷值  待生吸附剂性质：焦炭  待生吸附剂性质：S  ...  S-ZORB.AT-0011.DACA.PV  \\\n",
       "0     89.22        2.32       7.30  ...                0.496243   \n",
       "1     89.32        2.37       7.34  ...                0.491385   \n",
       "2     89.32        2.43       7.27  ...                0.495483   \n",
       "3     89.02        3.08       7.35  ...                0.490180   \n",
       "4     88.32        2.45       6.58  ...                0.501194   \n",
       "\n",
       "   S-ZORB.FT_1204.DACA.PV  S-ZORB.LC_5102.PIDA.PV  S-ZORB.TE_1102.DACA.PV  \\\n",
       "0               18.292067               42.015425              425.929515   \n",
       "1               19.842605               40.903878              421.534365   \n",
       "2               26.994896               42.103142              425.258420   \n",
       "3               26.324458               41.970416              424.406195   \n",
       "4               30.224367               42.900094              428.514740   \n",
       "\n",
       "   S-ZORB.CAL.LINE.PV  S-ZORB.CAL.CANGLIANG.PV  S-ZORB.CAL.SPEED.PV  \\\n",
       "0            0.282564                37.804650             3.324945   \n",
       "1            0.281381                37.876006             3.321169   \n",
       "2            0.282277                37.907927             3.319569   \n",
       "3            0.282275                39.177396             3.210211   \n",
       "4            0.282963                39.508370             3.178832   \n",
       "\n",
       "   S-ZORB.FT_1503.TOTALIZERA.PV  S-ZORB.FT_1504.TOTALIZERA.PV  \\\n",
       "0                    39063124.5                    39608757.0   \n",
       "1                    38810581.5                    39389299.0   \n",
       "2                    38693812.0                    39312616.5   \n",
       "3                    38410862.5                    39120204.5   \n",
       "4                    38283000.0                    39045953.5   \n",
       "\n",
       "   S-ZORB.PC_1001A.PV  \n",
       "0            0.353271  \n",
       "1            0.354504  \n",
       "2            0.350181  \n",
       "3            0.353930  \n",
       "4            0.358053  \n",
       "\n",
       "[5 rows x 199 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_325.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['原料性质：硫含量', '原料性质：辛烷值', '原料性质：饱和烃', '原料性质：烯烃', '原料性质：芳烃', '原料性质：溴值',\n",
       "       '原料性质：密度', '产品性质：辛烷值', '待生吸附剂性质：焦炭', '待生吸附剂性质：S', '再生吸附剂性质：焦炭',\n",
       "       '再生吸附剂性质：S', 'S-ZORB.CAL_H2.PV', 'S-ZORB.PDI_2102.PV',\n",
       "       'S-ZORB.PT_2801.PV', 'S-ZORB.FC_2801.PV', 'S-ZORB.TE_2103.PV',\n",
       "       'S-ZORB.TE_2005.PV', 'S-ZORB.PT_2101.PV', 'S-ZORB.PDT_2104.PV',\n",
       "       'S-ZORB.TE_2301.PV', 'S-ZORB.PT_2301.PV', 'S-ZORB.PC_2105.PV',\n",
       "       'S-ZORB.PC_5101.PV', 'S-ZORB.TC_5005.PV', 'S-ZORB.LC_5001.PV',\n",
       "       'S-ZORB.LC_5101.PV', 'S-ZORB.TE_5102.PV', 'S-ZORB.TE_5202.PV',\n",
       "       'S-ZORB.FT_5101.PV'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_325.columns[:30]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = data_325['产品性质：辛烷值']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "col_name = list(data_325.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['原料性质：硫含量',\n",
       " '原料性质：辛烷值',\n",
       " '原料性质：饱和烃',\n",
       " '原料性质：烯烃',\n",
       " '原料性质：芳烃',\n",
       " '原料性质：溴值',\n",
       " '原料性质：密度',\n",
       " '产品性质：辛烷值',\n",
       " '待生吸附剂性质：焦炭',\n",
       " '待生吸附剂性质：S',\n",
       " '再生吸附剂性质：焦炭',\n",
       " '再生吸附剂性质：S',\n",
       " 'S-ZORB.CAL_H2.PV',\n",
       " 'S-ZORB.PDI_2102.PV',\n",
       " 'S-ZORB.PT_2801.PV',\n",
       " 'S-ZORB.FC_2801.PV',\n",
       " 'S-ZORB.TE_2103.PV',\n",
       " 'S-ZORB.TE_2005.PV',\n",
       " 'S-ZORB.PT_2101.PV',\n",
       " 'S-ZORB.PDT_2104.PV',\n",
       " 'S-ZORB.TE_2301.PV',\n",
       " 'S-ZORB.PT_2301.PV',\n",
       " 'S-ZORB.PC_2105.PV',\n",
       " 'S-ZORB.PC_5101.PV',\n",
       " 'S-ZORB.TC_5005.PV',\n",
       " 'S-ZORB.LC_5001.PV',\n",
       " 'S-ZORB.LC_5101.PV',\n",
       " 'S-ZORB.TE_5102.PV',\n",
       " 'S-ZORB.TE_5202.PV',\n",
       " 'S-ZORB.FT_5101.PV']"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col_name[:30]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'产品性质：辛烷值'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col_name.pop(7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['原料性质：硫含量',\n",
       " '原料性质：辛烷值',\n",
       " '原料性质：饱和烃',\n",
       " '原料性质：烯烃',\n",
       " '原料性质：芳烃',\n",
       " '原料性质：溴值',\n",
       " '原料性质：密度',\n",
       " '待生吸附剂性质：焦炭',\n",
       " '待生吸附剂性质：S',\n",
       " '再生吸附剂性质：焦炭',\n",
       " '再生吸附剂性质：S',\n",
       " 'S-ZORB.CAL_H2.PV',\n",
       " 'S-ZORB.PDI_2102.PV',\n",
       " 'S-ZORB.PT_2801.PV',\n",
       " 'S-ZORB.FC_2801.PV',\n",
       " 'S-ZORB.TE_2103.PV',\n",
       " 'S-ZORB.TE_2005.PV',\n",
       " 'S-ZORB.PT_2101.PV',\n",
       " 'S-ZORB.PDT_2104.PV',\n",
       " 'S-ZORB.TE_2301.PV',\n",
       " 'S-ZORB.PT_2301.PV',\n",
       " 'S-ZORB.PC_2105.PV',\n",
       " 'S-ZORB.PC_5101.PV',\n",
       " 'S-ZORB.TC_5005.PV',\n",
       " 'S-ZORB.LC_5001.PV',\n",
       " 'S-ZORB.LC_5101.PV',\n",
       " 'S-ZORB.TE_5102.PV',\n",
       " 'S-ZORB.TE_5202.PV',\n",
       " 'S-ZORB.FT_5101.PV',\n",
       " 'S-ZORB.TE_9001.PV']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col_name[:30]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = data_325[ col_name ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(325, 198)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "from sklearn.neighbors import KNeighborsRegressor\n",
    "from sklearn.svm import SVR\n",
    "from sklearn.linear_model import Lasso\n",
    "from sklearn.linear_model import Ridge\n",
    "from sklearn.neural_network import MLPRegressor\n",
    "from sklearn.tree import DecisionTreeRegressor\n",
    "from sklearn.tree import ExtraTreeRegressor\n",
    "from xgboost import XGBRegressor\n",
    "from sklearn.ensemble import RandomForestRegressor\n",
    "from sklearn.ensemble import AdaBoostRegressor\n",
    "from sklearn.ensemble import GradientBoostingRegressor\n",
    "from sklearn.ensemble import BaggingRegressor\n",
    "\n",
    "\n",
    "\n",
    "models=[DecisionTreeRegressor(),RandomForestRegressor(),XGBRegressor(),AdaBoostRegressor(),GradientBoostingRegressor()]\n",
    "models_str=['DecisionTree', 'RandomForestRegressor','XGBoost','AdaBoost','GradientBoost']\n",
    "score_=[]\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "DecisionTree 最佳得分:0.8245855415723473\n",
      "DecisionTree 最佳参数: {'max_depth': 6}\n",
      "RandomForestRegressor 最佳得分:0.9230230969922465\n",
      "RandomForestRegressor 最佳参数: {'max_depth': 15, 'n_estimators': 50}\n",
      "XGBoost 最佳得分:0.9325100709653116\n",
      "XGBoost 最佳参数: {'learning_rate': 0.05, 'max_depth': 10, 'min_child_weight': 3, 'n_estimators': 200}\n",
      "AdaBoost 最佳得分:0.9249111897994405\n",
      "AdaBoost 最佳参数: {'learning_rate': 0.05, 'n_estimators': 50}\n",
      "GradientBoost 最佳得分:0.8966518239037776\n",
      "GradientBoost 最佳参数: {'learning_rate': 0.16, 'max_depth': 5, 'n_estimators': 200}\n"
     ]
    }
   ],
   "source": [
    "for name,model in zip(models_str,models):\n",
    "#     print('开始训练模型：'+name)\n",
    "#     model=model   #建立模型\n",
    "#     model.fit(x_train,y_train)\n",
    "#     y_pred=model.predict(x_test)  \n",
    "#     score_model = model.score(x_test,y_test)\n",
    "#     print(name +' 得分:'+str(score_model))\n",
    "    if name == 'DecisionTree':\n",
    "        para_dict = {\n",
    "        'max_depth': [m for m in range(5,10)]\n",
    "        }\n",
    "    elif name == 'XGBoost':\n",
    "        para_dict = {\n",
    "        \"max_depth\": [5,10,15],\n",
    "        \"min_child_weight\" : [1,3,6],\n",
    "        \"n_estimators\": [50,100,200],\n",
    "        \"learning_rate\": [0.05, 0.1]\n",
    "        }\n",
    "    elif name == 'RandomForestRegressor':\n",
    "        para_dict = {\n",
    "        \"max_depth\": [5,10,15],\n",
    "        \"n_estimators\": [50,100,200]\n",
    "        }\n",
    "    elif name == 'AdaBoost':\n",
    "        para_dict = {\n",
    "        \"n_estimators\": [50,100,200],\n",
    "        \"learning_rate\": [0.05, 0.1]\n",
    "        }\n",
    "    elif name == 'GradientBoost':\n",
    "        para_dict = {\n",
    "        \"max_depth\": [5,10,15],\n",
    "        \"n_estimators\": [50,100,200],\n",
    "        \"learning_rate\": [0.05, 0.1,0.16]\n",
    "        }\n",
    "    gcv = GridSearchCV(model, para_dict)\n",
    "    gcv.fit(x_train,y_train)\n",
    "    gcv_pre = gcv.predict(x_test)\n",
    "    gcv_score = gcv.score(x_test,y_test)\n",
    "    gcv_feature = gcv.best_params_\n",
    "    print(name +' 最佳得分:'+str(gcv.best_score_ ))\n",
    "    print(name + \" 最佳参数:\", gcv_feature)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# from sklearn.feature_selection import SelectFromModel\n",
    "# from sklearn.ensemble import RandomForestRegressor # 同样以此模型举例\n",
    "# rf = RandomForestRegressor() # 默认参数\n",
    "# rf.fit(X, y)\n",
    "# model = SelectFromModel(rf)\n",
    "# X_new = model.transform(X)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
